﻿using AutoMapper;
using System;

namespace IceCS.AutoMapper.Core
{
    public class M
    {
        public static IMapper Mapper { get; set; }
        private static IConfigurationProvider configuration;
        static M()
        {
            //CreateMapper();
        }

        private static IConfigurationProvider CreateMapper()
        {
            configuration = new MapperConfiguration(config =>
            {
                //config.CreateMap<UserInfo, UserInfoSummaryDto>();
                //config.CreateMap<UserInfo, UserInfoSummary2Dto>();

                config.AddProfile<UserInfoAutoMapperProfile>();
            });
#if DEBUG
            // only during development, validate your mappings; remove it before release
            configuration.AssertConfigurationIsValid();
#endif
            Mapper = configuration.CreateMapper();
            //Mapper = new Mapper(configuration);
            return configuration;
        }

        public static IConfigurationProvider Configure()
        {
            var configuration = CreateMapper();
            return configuration;
        }
    }
}
